{extend name="public/best"/}
{block name="title"}
{:lang('MemberLogin')}
{/block}
{block name="main"}
<div class="login-main">
    <div class="login-main__container">
        <div class="layui-elip">{:lang('MemberLogin')}</div>
        <form class="layui-form" action="{:url('login')}">
            <input type="hidden" name="forward" value="{$forward}" />
            {:token()}

            {eq name="Member_config.sms_verify_login" value="1"}
            <div class="layui-form-item">
                <div class="layui-input-inline input-item">
                    <input type="text" name="mobile" lay-verify="required" autocomplete="off" placeholder="{:lang('phone')}" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-inline" style="width: 60%;">
                    <input type="text" name="captcha_mobile" required="" lay-verify="required" autocomplete="off" value="" class="layui-input" placeholder="{:lang('PhoneVerificationCode')}"> </div>
                <button class="layui-btn btn-captcha layui-btn-primary" type="button" data-event="login" data-type="mobile" data-url="{:url('api/sms/send')}">{:lang('GetVerificationCode')}</button>
            </div>
            {else}
            <div class="layui-form-item">
                <div class="layui-input-inline input-item">
                    <input type="text" name="account" lay-verify="required" autocomplete="off" placeholder="{:lang('Account')}" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-inline input-item">
                    <input type="password" name="password" lay-verify="required" autocomplete="off" placeholder="{:lang('Password')}" class="layui-input">
                </div>
            </div>
            {/eq}
            {eq name="Member_config.openverification" value="1"}
            <div class="layui-form-item">
                <div class="layui-input-inline input-item verify-box">
                    <input type="text" name="verify" lay-verify="required" placeholder="{:lang('captcha')}" autocomplete="off" class="layui-input">
                    <img id="verify" src="{:captcha_src()}" alt="验证码" class="captcha">
                </div>
            </div>
            {/eq}
            <div class="layui-form-item">
                <input type="checkbox" name="keeplogin" lay-skin="primary" title="{:lang('Logged')}" value="1" checked>
                <a href="{:url('forget')}" class="lay-user-jump-change lay-link" style="margin-top: 7px;">{:lang('Forget')}？</a>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-inline login-btn">
                    <button class="layui-btn layui-btn-danger" lay-submit>{:lang('login')}</button>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-trans layui-form-item lay-user-login-other">
                    {:hook('sync_login')}
                    <a href="{:url('register')}" class="lay-user-jump-change lay-link">{:lang('Registered')}</a>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="js"}
    <script type="text/javascript">
    layui.use(['form', 'layer','yznForm'], function() {
        var form = layui.form,
            layer = layui.layer,
            yznForm = layui.yznForm;

            yznForm.listen('', function (res) {
                layer.msg(res.msg, {
                    offset: '15px',
                    icon: 1,
                    time: 1000
                }, function() {
                    window.location.href = res.url;
                });
                return false;
            }, function (res) {
                //刷新验证码
                $("#verify").click();
                //layer.msg(res.msg, { icon: 5 });
            });
    });
    //刷新验证码
    $("#verify").click(function() {
        var verifyimg = $("#verify").attr("src");
        $("#verify").attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
    });
    </script>
{/block}